from fastapi import Request
from rocketry import Rocketry

from afast_core.core_plugins.scheduler.rocketry import RocketrySchedulerPluginClient




def get_rocke_schedule_plugin_client_producer(request: Request) -> RocketrySchedulerPluginClient:
    """
    返回事件处理的客户端对象
    :param request: current request.
    :return: pyee_events producer from the core_app.
    """
    return request.app.rocke_schedule_plugin_client


def get_rocke_schedule_producer(request: Request) -> Rocketry:
    """
    返回事件处理的客户端内部的原始的事件对象
    :param request: current request.
    :return: pyee_events producer from the core_app.
    """
    return request.app.state.rocke_schedule
